UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lzqU3J5uDJhkLTUduWSENoi8+DYNRsGjovAbqN7rTLQ=' 
WHERE 
  key_id = 'a2d0799e40ffd840b1c8364070f3d77c269ffa2c7cf6293efe8b00a707b4cf1d' 
  AND (
    token = 'lzqU3J5uDJhkLTUduWSENoi8+DYNRsGjovAbqN7rTLQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021