UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0pET8KypeaAH/11e/KsCJdxiOKh2U5qefr9CU+L7BVg=' 
WHERE 
  key_id = '24e588beac43b900ebabf762bb3ca15b228cc6646609c6724045ccafa1a1b37f' 
  AND (
    token = '0pET8KypeaAH/11e/KsCJdxiOKh2U5qefr9CU+L7BVg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035