UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R+yFENlmMxixtNtoYMSnhsg+vi01Q3jVktvFTjl/b6Q=' 
WHERE 
  key_id = 'e635ad46cac86983cb38e9b7c8b4e3bfd34389a10d3201932ff3fec33ca5e90d' 
  AND (
    token = 'R+yFENlmMxixtNtoYMSnhsg+vi01Q3jVktvFTjl/b6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034