UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GoHu9zf2cjBSyvF3VZb0zU0LaNV+fjChx1YIqIvawqE=' 
WHERE 
  key_id = '4be623dfa9b173508895a36913c83266b70139882decc4b2c09c91c7b4234a09' 
  AND (
    token = 'GoHu9zf2cjBSyvF3VZb0zU0LaNV+fjChx1YIqIvawqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029