UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u61x9gcoEHQEo1j57umYpcr0V4hzZ7fCv+njFYaREEg=' 
WHERE 
  key_id = 'd580e167d6ac68bdbf14c85b2970f1d085210c6e2a6f9c8428dc180c6ef0714f' 
  AND (
    token = 'u61x9gcoEHQEo1j57umYpcr0V4hzZ7fCv+njFYaREEg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025