UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OaL/Tb+vlOa+ENEDrhytoMEvbQyy/KAPEgfQ6KTRP5w=' 
WHERE 
  key_id = 'b66a9ba01f2cda356f9dc20c71a5aea751c36fb5d5e54225bf813f30544df981' 
  AND (
    token = 'OaL/Tb+vlOa+ENEDrhytoMEvbQyy/KAPEgfQ6KTRP5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041