UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Djfahui5Tg7V1zmxpIFFmEaQhN58aqE+YL67oqX20Cc=' 
WHERE 
  key_id = 'ad98247dbf7cc32f77f2faaa06f12d7fe6bba0578c739a6d456a165e27c6c193' 
  AND (
    token = 'Djfahui5Tg7V1zmxpIFFmEaQhN58aqE+YL67oqX20Cc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023