UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HNeyxYRt4hfac0FHTombgiTdV+H3FfCz8DRiyIH++qE=' 
WHERE 
  key_id = 'de10532391ac77ec9278959ebdfe4c2227ae33cee90478359459da6c56036398' 
  AND (
    token = 'HNeyxYRt4hfac0FHTombgiTdV+H3FfCz8DRiyIH++qE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024