UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'URubWZbFrrYYr+fmnv24G5oWc54ScXJVZjBo9ImNrZs=' 
WHERE 
  key_id = '204a802eb6300422ff9beb04cf9f05e3c2f96eeb8545a27d23c4a9e7c55c59df' 
  AND (
    token = 'URubWZbFrrYYr+fmnv24G5oWc54ScXJVZjBo9ImNrZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021