UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Scd0Z+rBE4MLwy5fNvisfpu8mSY7PG7jx6Y3gjTxGmM=' 
WHERE 
  key_id = '9660876a10a92c5ba98fd4e8f759e082bffc368cd8a63e919f168346bee52229' 
  AND (
    token = 'Scd0Z+rBE4MLwy5fNvisfpu8mSY7PG7jx6Y3gjTxGmM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034