UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W9Dtak6Vmo5jDQV8d8zxFRK6e2BRzuGMTfoPkc1NUiU=' 
WHERE 
  key_id = 'ec352478d3c14be14eac47b9a9988244161f3bb622ffb9bbc318d2f8c0be1083' 
  AND (
    token = 'W9Dtak6Vmo5jDQV8d8zxFRK6e2BRzuGMTfoPkc1NUiU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025