UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DB14quup79lBQerXRgRwRVmWXjZ5UJf9GymVVHQb5FE=' 
WHERE 
  key_id = '5d54d9c07c98468403d896ef07291829275857cbc8a8760f5a5471fa7f865a84' 
  AND (
    token = 'DB14quup79lBQerXRgRwRVmWXjZ5UJf9GymVVHQb5FE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016