UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P5qc5INCPoCrPMUlqt3ZyXQz22mWxJKVuytl1D4BAV8=' 
WHERE 
  key_id = '2d62d0641423f77f42980327979e174b02d4a3ecca3ec3990d78579ff7ec3622' 
  AND (
    token = 'P5qc5INCPoCrPMUlqt3ZyXQz22mWxJKVuytl1D4BAV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034