UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vlc+a/rKtk2MLl3FfSTOwf5gZJGPa60W9dzjus5r+E4=' 
WHERE 
  key_id = '74c856f175ee29355393651e49afa6ce03a15d37a9fe24b1369017c94c299650' 
  AND (
    token = 'Vlc+a/rKtk2MLl3FfSTOwf5gZJGPa60W9dzjus5r+E4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030