UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j65frgdhasBT6/3V65bv07EEw3S1qKAMTf2VyJRuaQc=' 
WHERE 
  key_id = 'd88839126608f8bacb3c3930588f4b537075a1863e9eda3cfef156b924406653' 
  AND (
    token = 'j65frgdhasBT6/3V65bv07EEw3S1qKAMTf2VyJRuaQc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022