UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qIqh3gbOGy1sAL+1Ck40+FJLZSY6djyiHmMpHs6ryWw=' 
WHERE 
  key_id = '42f47b18752f633b8a801558a140077819f8afba49dea50928430e8e1fd2e29b' 
  AND (
    token = 'qIqh3gbOGy1sAL+1Ck40+FJLZSY6djyiHmMpHs6ryWw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017