UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c8po323tQm9XFrj5ZFkT+qnMi3qbOV+6NonHVASLHK8=' 
WHERE 
  key_id = '56835110972dda44967b46137355a0fe2286a4944be03f126bdf781bf2f5e923' 
  AND (
    token = 'c8po323tQm9XFrj5ZFkT+qnMi3qbOV+6NonHVASLHK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033