UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hWMMaNt4VzZq64AS3bKd9TXcuMNYZFaFvzC51e/uz/s=' 
WHERE 
  key_id = '829a3281c52cde3279e23d5a8e7e6e58006b97f798a0f682f6cc546b27767f29' 
  AND (
    token = 'hWMMaNt4VzZq64AS3bKd9TXcuMNYZFaFvzC51e/uz/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032