UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KOtP8gKqfHKhkdi4PngUnw8ej2N+6fyBW53KYW0TvmI=' 
WHERE 
  key_id = '287bf9367f1d2d8e8ea518953641a0ae1b7a68dbb78581461724975af4e638b5' 
  AND (
    token = 'KOtP8gKqfHKhkdi4PngUnw8ej2N+6fyBW53KYW0TvmI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061