UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ebW6k2j9u4UIXJJPq2quvfx0yRiFaYlZc6p/0Tjjovs=' 
WHERE 
  key_id = '9680adfc1fef8e7fb34b73c20b992fe9a2c66f847237fb41f81655e06ba16a4a' 
  AND (
    token = 'ebW6k2j9u4UIXJJPq2quvfx0yRiFaYlZc6p/0Tjjovs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028