UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lgVuaCcR+Iq5SWiMinF1ubQWbATEcJeSgjQ7QW1q+3w=' 
WHERE 
  key_id = '2fb46a6febdd4fbb234d5a91f6c6903de4dcc0259cc75c209775a1cd6ffd89eb' 
  AND (
    token = 'lgVuaCcR+Iq5SWiMinF1ubQWbATEcJeSgjQ7QW1q+3w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038