UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hYnHHDiMDO7uPufWKeIDvpYKFxPb03TrPfIz3kWCD8o=' 
WHERE 
  key_id = '82134a1df40fd280f07a80e87b0c667a2f560668aab778c09b4547b7db2dca4e' 
  AND (
    token = 'hYnHHDiMDO7uPufWKeIDvpYKFxPb03TrPfIz3kWCD8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041