UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o0evu4Jl2z+vmnPo44WhL5zHtNGKSTnK5QzxXPfp714=' 
WHERE 
  key_id = 'd5fb7bd667ef49bd03af142b89f68352a46c5ddeb155b3cf42dee40d27af0481' 
  AND (
    token = 'o0evu4Jl2z+vmnPo44WhL5zHtNGKSTnK5QzxXPfp714=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026