UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ux8Hfo6OVqOI5yvHI8wY0sy42k34i7dHFKno29ZN2qs=' 
WHERE 
  key_id = 'ed77d3087ae42db0c6bc1a14371fa580af18388956344264aa0c3aaff7c0d6a7' 
  AND (
    token = 'Ux8Hfo6OVqOI5yvHI8wY0sy42k34i7dHFKno29ZN2qs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051