UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZfnG4gKYFUygRfSR2sppo1qFgcXlNN9iAJLusYAtlew=' 
WHERE 
  key_id = '3391ad36579d4ed3b1a5e007cab8e122ea30af0f992aaa726aafe21e9ec38915' 
  AND (
    token = 'ZfnG4gKYFUygRfSR2sppo1qFgcXlNN9iAJLusYAtlew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041