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

Query time 0.00039