UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OESdDlA9Q+MrgAg22+zthDMP7oJln4oo1GUKbnesdpA=' 
WHERE 
  key_id = 'acb69f7eae599a9a2730af706809b25701a49581de1bb0c376f2b713dde97a8f' 
  AND (
    token = 'OESdDlA9Q+MrgAg22+zthDMP7oJln4oo1GUKbnesdpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029