UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T7qFZ0Ub2exgS1qSRjrQHog3QPd1HIk+m8F2eaFUNgU=' 
WHERE 
  key_id = '8ee0d43620dc97ace5e870e6f56b47938b073834ae744982246643070d2f3168' 
  AND (
    token = 'T7qFZ0Ub2exgS1qSRjrQHog3QPd1HIk+m8F2eaFUNgU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020