UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y823no+KIf9pKRRBQ9Ts9OVyNSGAuBwG0aDh+cK0nZs=' 
WHERE 
  key_id = '577e1be9ae47edc8417ce6769babe8add660d53dbc60bd0e037bfece5bb2a5a4' 
  AND (
    token = 'y823no+KIf9pKRRBQ9Ts9OVyNSGAuBwG0aDh+cK0nZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040