UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5spIAZ9MrwKiPJeySxXe8/SwQ+20V/oYxBPioDUisaU=' 
WHERE 
  key_id = 'afc2e8f7c91255c9aca8b7b802934776a86a64a780e7070a1c777408b304a3ba' 
  AND (
    token = '5spIAZ9MrwKiPJeySxXe8/SwQ+20V/oYxBPioDUisaU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039