UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z0fj0geuqeTKAtsz7vE+Yi7Uh1HX2h5GhVux9WdM1aA=' 
WHERE 
  key_id = '33e5aed9c3d2a3ac33c777e9a159d321552cce312e0f4455db48e774e7274c8b' 
  AND (
    token = 'Z0fj0geuqeTKAtsz7vE+Yi7Uh1HX2h5GhVux9WdM1aA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050