UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l+PYjkTPVF5XqSOl/JzwGnFk1e+Ry8TRjUmRp0WuI+E=' 
WHERE 
  key_id = '4da5f19e4c11863784ec5c6287f72af86273436d05c7d9d23df24f2b08566892' 
  AND (
    token = 'l+PYjkTPVF5XqSOl/JzwGnFk1e+Ry8TRjUmRp0WuI+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032