UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bE52WpD8pHEZYspWionzmOmeXdlGz+BELe1W/TapUwo=' 
WHERE 
  key_id = 'adf23a5eda1a0b2e0e79ff3f2bcc16823a420fb9b62f515eec0463a33e66aac1' 
  AND (
    token = 'bE52WpD8pHEZYspWionzmOmeXdlGz+BELe1W/TapUwo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029